(0) Obligation:

The Runtime Complexity (innermost) of the given CpxTRS could be proven to be BOUNDS(1, n^1).


The TRS R consists of the following rules:

admit(x, nil) → nil
admit(x, .(u, .(v, .(w, z)))) → cond(=(sum(x, u, v), w), .(u, .(v, .(w, admit(carry(x, u, v), z)))))
cond(true, y) → y

Rewrite Strategy: INNERMOST

(1) TrsToWeightedTrsProof (BOTH BOUNDS(ID, ID) transformation)

Transformed TRS to weighted TRS

(2) Obligation:

The Runtime Complexity (innermost) of the given CpxWeightedTrs could be proven to be BOUNDS(1, n^1).


The TRS R consists of the following rules:

admit(x, nil) → nil [1]
admit(x, .(u, .(v, .(w, z)))) → cond(=(sum(x, u, v), w), .(u, .(v, .(w, admit(carry(x, u, v), z))))) [1]
cond(true, y) → y [1]

Rewrite Strategy: INNERMOST

(3) TypeInferenceProof (BOTH BOUNDS(ID, ID) transformation)

Infered types.

(4) Obligation:

Runtime Complexity Weighted TRS with Types.
The TRS R consists of the following rules:

admit(x, nil) → nil [1]
admit(x, .(u, .(v, .(w, z)))) → cond(=(sum(x, u, v), w), .(u, .(v, .(w, admit(carry(x, u, v), z))))) [1]
cond(true, y) → y [1]

The TRS has the following type information:
admit :: carry → nil:. → nil:.
nil :: nil:.
. :: w → nil:. → nil:.
w :: w
cond :: =:true → nil:. → nil:.
= :: sum → w → =:true
sum :: carry → w → w → sum
carry :: carry → w → w → carry
true :: =:true

Rewrite Strategy: INNERMOST

(5) CompletionProof (UPPER BOUND(ID) transformation)

The TRS is a completely defined constructor system, as every type has a constant constructor and the following rules were added:

admit(v0, v1) → null_admit [0]
cond(v0, v1) → null_cond [0]

And the following fresh constants:

null_admit, null_cond, const, const1

(6) Obligation:

Runtime Complexity Weighted TRS where all functions are completely defined. The underlying TRS is:

Runtime Complexity Weighted TRS with Types.
The TRS R consists of the following rules:

admit(x, nil) → nil [1]
admit(x, .(u, .(v, .(w, z)))) → cond(=(sum(x, u, v), w), .(u, .(v, .(w, admit(carry(x, u, v), z))))) [1]
cond(true, y) → y [1]
admit(v0, v1) → null_admit [0]
cond(v0, v1) → null_cond [0]

The TRS has the following type information:
admit :: carry → nil:.:null_admit:null_cond → nil:.:null_admit:null_cond
nil :: nil:.:null_admit:null_cond
. :: w → nil:.:null_admit:null_cond → nil:.:null_admit:null_cond
w :: w
cond :: =:true → nil:.:null_admit:null_cond → nil:.:null_admit:null_cond
= :: sum → w → =:true
sum :: carry → w → w → sum
carry :: carry → w → w → carry
true :: =:true
null_admit :: nil:.:null_admit:null_cond
null_cond :: nil:.:null_admit:null_cond
const :: carry
const1 :: sum

Rewrite Strategy: INNERMOST

(7) CpxTypedWeightedTrsToRntsProof (UPPER BOUND(ID) transformation)

Transformed the TRS into an over-approximating RNTS by (improved) Size Abstraction.
The constant constructors are abstracted as follows:

nil => 0
w => 0
true => 0
null_admit => 0
null_cond => 0
const => 0
const1 => 0

(8) Obligation:

Complexity RNTS consisting of the following rules:

admit(z', z'') -{ 1 }→ cond(1 + (1 + x + u + v) + 0, 1 + u + (1 + v + (1 + 0 + admit(1 + x + u + v, z)))) :|: v >= 0, z >= 0, z' = x, x >= 0, z'' = 1 + u + (1 + v + (1 + 0 + z)), u >= 0
admit(z', z'') -{ 1 }→ 0 :|: z'' = 0, z' = x, x >= 0
admit(z', z'') -{ 0 }→ 0 :|: v0 >= 0, v1 >= 0, z'' = v1, z' = v0
cond(z', z'') -{ 1 }→ y :|: z'' = y, y >= 0, z' = 0
cond(z', z'') -{ 0 }→ 0 :|: v0 >= 0, v1 >= 0, z'' = v1, z' = v0

Only complete derivations are relevant for the runtime complexity.

(9) CompleteCoflocoProof (EQUIVALENT transformation)

Transformed the RNTS (where only complete derivations are relevant) into cost relations for CoFloCo:

eq(start(V, V1),0,[admit(V, V1, Out)],[V >= 0,V1 >= 0]).
eq(start(V, V1),0,[cond(V, V1, Out)],[V >= 0,V1 >= 0]).
eq(admit(V, V1, Out),1,[],[Out = 0,V1 = 0,V = V2,V2 >= 0]).
eq(admit(V, V1, Out),1,[admit(1 + V3 + V4 + V5, V6, Ret1111),cond(1 + (1 + V3 + V4 + V5) + 0, 1 + V4 + (1 + V5 + (1 + 0 + Ret1111)), Ret)],[Out = Ret,V5 >= 0,V6 >= 0,V = V3,V3 >= 0,V1 = 3 + V4 + V5 + V6,V4 >= 0]).
eq(cond(V, V1, Out),1,[],[Out = V7,V1 = V7,V7 >= 0,V = 0]).
eq(admit(V, V1, Out),0,[],[Out = 0,V8 >= 0,V9 >= 0,V1 = V9,V = V8]).
eq(cond(V, V1, Out),0,[],[Out = 0,V10 >= 0,V11 >= 0,V1 = V11,V = V10]).
input_output_vars(admit(V,V1,Out),[V,V1],[Out]).
input_output_vars(cond(V,V1,Out),[V,V1],[Out]).

CoFloCo proof output:
Preprocessing Cost Relations
=====================================

#### Computed strongly connected components
0. non_recursive : [cond/3]
1. recursive [non_tail] : [admit/3]
2. non_recursive : [start/2]

#### Obtained direct recursion through partial evaluation
0. SCC is partially evaluated into cond/3
1. SCC is partially evaluated into admit/3
2. SCC is partially evaluated into start/2

Control-Flow Refinement of Cost Relations
=====================================

### Specialization of cost equations cond/3
* CE 8 is refined into CE [9]
* CE 7 is refined into CE [10]


### Cost equations --> "Loop" of cond/3
* CEs [9] --> Loop 6
* CEs [10] --> Loop 7

### Ranking functions of CR cond(V,V1,Out)

#### Partial ranking functions of CR cond(V,V1,Out)


### Specialization of cost equations admit/3
* CE 4 is refined into CE [11]
* CE 6 is refined into CE [12]
* CE 5 is refined into CE [13]


### Cost equations --> "Loop" of admit/3
* CEs [13] --> Loop 8
* CEs [11,12] --> Loop 9

### Ranking functions of CR admit(V,V1,Out)
* RF of phase [8]: [V/2+V1/2-1,V1/3-2/3]

#### Partial ranking functions of CR admit(V,V1,Out)
* Partial RF of phase [8]:
- RF of loop [8:1]:
V/2+V1/2-1
V1/3-2/3


### Specialization of cost equations start/2
* CE 2 is refined into CE [14]
* CE 3 is refined into CE [15,16]


### Cost equations --> "Loop" of start/2
* CEs [14,15,16] --> Loop 10

### Ranking functions of CR start(V,V1)

#### Partial ranking functions of CR start(V,V1)


Computing Bounds
=====================================

#### Cost of chains of cond(V,V1,Out):
* Chain [7]: 1
with precondition: [V=0,V1=Out,V1>=0]

* Chain [6]: 0
with precondition: [Out=0,V>=0,V1>=0]


#### Cost of chains of admit(V,V1,Out):
* Chain [[8],9]: 1*it(8)+1
Such that:it(8) =< V1/3

with precondition: [Out=0,V>=0,V1>=3]

* Chain [9]: 1
with precondition: [Out=0,V>=0,V1>=0]


#### Cost of chains of start(V,V1):
* Chain [10]: 1*s(2)+1
Such that:s(2) =< V1/3

with precondition: [V>=0,V1>=0]


Closed-form bounds of start(V,V1):
-------------------------------------
* Chain [10] with precondition: [V>=0,V1>=0]
- Upper bound: V1/3+1
- Complexity: n

### Maximum cost of start(V,V1): V1/3+1
Asymptotic class: n
* Total analysis performed in 75 ms.

(10) BOUNDS(1, n^1)